<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>申请书管理</title>
	<meta name="decorator" content="default"/>
	<%@ include file="/WEB-INF/views/include/pdf.jsp"%>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#mymodal").css({"margin-top": "700px"});
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		function viewPdf(url){
			// If absolute URL from the remote server is provided, configure the CORS
			// header on that server.
			$('#pdf_preview').attr("src",url);
			$('#pdf_preview').media(
			{
			  width : '100%',
			  height : '700px',
			  autoplay : true
			});
			$("#mymodal").css({"margin-top": "0px"});
			$("#mymodal").modal('show');
		}
	</script>
</head>

<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/applybook/bizApplyBook/provinceList">申请列表</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="bizApplyBook" action="${ctx}/applybook/bizApplyBook/provinceList" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>申请分类：</label>
				<sys:treeselect notAllowSelectParent="true" id="baseCategory" name="categoryId" value="${bizApplyBook.categoryId}" labelName="categoryName" labelValue="${bizApplyBook.categoryName}"
					title="分类" url="/category/baseCategory/treeData"   allowClear="true"/>
					<span class="help-inline"><font color="red">*</font> </span>
			</li>
			<li><label>申请类型：</label>
				<form:select path="applyType" class="input-medium">
					<form:option value="" label=""/>
					<form:options items="${fns:getDictList('apply_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>申请标题</th>
				<th>申请分类</th>
				<th>申请类型</th>
				<th>申请状态</th>
				<th>创建时间</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="bizApplyBookD">
			<tr>
				<td>
					<a href="${ctx}/applybook/bizApplyBook/form?opt=detail&id=${bizApplyBookD.id}">
						${bizApplyBookD.title}
					</a>
				</td>
				<td>
				${bizApplyBookD.categoryName}
				</td>
				<td>
				${fns:getDictLabel(bizApplyBookD.applyType, 'apply_type', '')}
				</td>
				<td>
				${fns:getDictLabel(bizApplyBookD.bookStatus, 'bookStatus', '')}
				</td>
				<td>
					<fmt:formatDate value="${bizApplyBookD.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					<a href="#"  id="preBut" data-toggle="modal" style="${empty bizApplyBookD.pdfUrl?'display:none':'' }" onclick="javascript:viewPdf('${bizApplyBookD.pdfUrl}')" data-target="#myModal">预览附件</a>
					<c:if test="${bizApplyBookD.bookStatus==1 and  bizApplyBook.bookStatus==1}">
						<a href="${ctx}/applybook/bizApplyBook/accept?id=${bizApplyBookD.id}&bookStatus=2" onclick="return confirmx('确认要受理吗？', this.href)">受理</a>
						<a href="${ctx}/applybook/bizApplyBook/accept?id=${bizApplyBookD.id}&bookStatus=-1" onclick="return confirmx('确认要驳回吗？', this.href)">驳回</a>
					</c:if>
					<c:if test="${bizApplyBookD.bookStatus==2 and bizApplyBook.bookStatus==2}">
						<a href="${ctx}/applybook/bizApplyBook/accept?id=${bizApplyBookD.id}&bookStatus=3" onclick="return confirmx('确认要准许填报吗？', this.href)">准许填报</a>
						<a href="${ctx}/applybook/bizApplyBook/accept?id=${bizApplyBookD.id}&bookStatus=-1" onclick="return confirmx('确认要驳回吗？', this.href)">驳回</a>
					</c:if>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
	
	<!-- 模态框（Modal） -->
	<div class="modal fade" id="myModal"  tabindex="-1" role="dialog" style="max-height:100%;height:100%;"   aria-labelledby="myModalLabel" aria-hidden="true" >
		<div class="modal-dialog"  style="max-height:100%;height:100%">
			<div class="modal-content"  style="max-height:100%;height:100%"> 
				<div class="modal-body"  style="max-height:100%;height:80%">
					<div id="pdf_preview"></div>
				</div>
				<div class="modal-footer" style="height:20%">
					<button type="button" class="btn btn-default" data-dismiss="modal" id="guideCloseBut">关闭</button>
				</div>
			</div>
		</div>
		<!-- /.modal -->
	</div>
</body>
</html>